<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Envio_email {
	/** 
	Libreria para enviar el email
	Se necesita:
	*Contenido
	*Asunto
	*Receptor
	IMPORTANTE el contenido del mail no debe incorporar los marcos del email, ya que estos los incluye el metodo
	*/
	function enviarEmail($info){
		$asunto = $info['asunto'];
		$conten ='<table width="100%" cellpadding="10" cellspacing="4">
			<tr>
			<td align="center">
				<table style="width:699px" cellpadding="10" cellspacing="4" align="center" style="display: table; border-collapse: separate; text-align:justify">
					<tr>
						<td colspan="2" style="height:90px; background-color:#4e3467;border-radius: 15px 15px 15px 15px;">
							<img style="margin-left:-4px" src="http://www.eadeconsulting.com/controleade/imagenes/eadecabecera.png"/>
						</td>
					</tr>
					<tr>
						<td style="width:550px; background-color:#e7e7e7;border-radius: 15px 15px 15px 15px;box-shadow: 0px 2px 0px #999999;">
						'.$info['cuerpo'].'
						</td>
						<td style="width:140px;background-color:#e7e7e7;border-radius: 15px 15px 15px 15px;box-shadow: 0px 2px 0px #999999;font-size:15">
							<p>EADE Consulting J.E.</p>
							<p>info@eadeconsulting.com</p>
							<p>+34 964728512</p>
							<a href="#">www.eadeconsulting.com</a>
							</br>
							<table style="padding-top:25px">
								<tr>
									<td width="35" align="center"><a href="http://www.facebook.com/eadeconsulting" target="_blank"><img src="http://www.eadeconsulting.com/controleade/imagenes/logofacebook.jpg" border="0" alt="icon" width="32" height="34" /></a></td>
									<td width="35" align="center"><a href="https://twitter.com/eadeconsulting" target="_blank"><img src="http://www.eadeconsulting.com/controleade/imagenes/logotwiter.jpg" border="0" alt="icon" width="32" height="34" /></a></td>
									<td width="35" align="center"><a href="https://www.linkedin.com/company/3094737?trk=tyah&trkInfo=tarId%3A1415977006976%2Ctas%3Aeade%20consulting%2Cidx%3A2-1-3" target="_blank"><img src="http://www.eadeconsulting.com/controleade/imagenes/logolinkedin.png" border="0" alt="icon" width="32" height="34" /></a></td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="2" style="height:70px;font-family: Verdana, Geneva, sans-serif; color:#FFF;text-align:center; font-size: 15px; text-decoration: none;background-color:#6b696e;border-radius: 15px 15px 15px 15px;">
							<p>eadeconsulting.com</a> &copy; 2010 Copyright - Todos los derechos reservados.<br />  Campus de Riu Sec. Despacho JAA118SD Castellon (12071) Espa&ntilde;a</p>
						</td>
					</tr>
				</table>
			</td>
			<tr>
			</table>
			';
			$CI =& get_instance();
			$CI->load->library('email');
			$CI->email->from('info@eadeconsulting.com', 'EADE Consulting J.E');
			$CI->email->to($info['destino']);
			$CI->email->subject($asunto);
			$CI->email->message($conten);
			$CI->email->send();
	}
	
	
	/*
	Email con adjuntos
	*/
	
	function enviarEmailConAdjunto($info){
		$asunto = $info['asunto'];
		$conten ='<table width="100%" cellpadding="10" cellspacing="4">
			<tr>
			<td align="center">
				<table style="width:699px" cellpadding="10" cellspacing="4" align="center" style="display: table; border-collapse: separate; text-align:justify">
					<tr>
						<td colspan="2" style="height:90px; background-color:#4e3467;border-radius: 15px 15px 15px 15px;">
							<img style="margin-left:-4px" src="http://www.eadeconsulting.com/controleade/imagenes/eadecabecera.png"/>
						</td>
					</tr>
					<tr>
						<td style="width:550px; background-color:#e7e7e7;border-radius: 15px 15px 15px 15px;box-shadow: 0px 2px 0px #999999;">
						'.$info['cuerpo'].'
						</td>
						<td style="width:140px;background-color:#e7e7e7;border-radius: 15px 15px 15px 15px;box-shadow: 0px 2px 0px #999999;font-size:15">
							<p>EADE Consulting J.E.</p>
							<p>info@eadeconsulting.com</p>
							<p>+34 964728512</p>
							<a href="#">www.eadeconsulting.com</a>
							</br>
							<table style="padding-top:25px">
								<tr>
									<td width="35" align="center"><a href="http://www.facebook.com/eadeconsulting" target="_blank"><img src="http://www.eadeconsulting.com/controleade/imagenes/logofacebook.jpg" border="0" alt="icon" width="32" height="34" /></a></td>
									<td width="35" align="center"><a href="https://twitter.com/eadeconsulting" target="_blank"><img src="http://www.eadeconsulting.com/controleade/imagenes/logotwiter.jpg" border="0" alt="icon" width="32" height="34" /></a></td>
									<td width="35" align="center"><a href="https://www.linkedin.com/company/3094737?trk=tyah&trkInfo=tarId%3A1415977006976%2Ctas%3Aeade%20consulting%2Cidx%3A2-1-3" target="_blank"><img src="http://www.eadeconsulting.com/controleade/imagenes/logolinkedin.png" border="0" alt="icon" width="32" height="34" /></a></td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="2" style="height:70px;font-family: Verdana, Geneva, sans-serif; color:#FFF;text-align:center; font-size: 15px; text-decoration: none;background-color:#6b696e;border-radius: 15px 15px 15px 15px;">
							<p>eadeconsulting.com</a> &copy; 2010 Copyright - Todos los derechos reservados.<br />  Campus de Riu Sec. Despacho JAA118SD Castellon (12071) Espa&ntilde;a</p>
						</td>
					</tr>
				</table>
			</td>
			<tr>
			</table>
			';
			$CI =& get_instance();
			$CI->load->library('email');
			$CI->email->attach($info['adjunto']);
			$CI->email->from('info@eadeconsulting.com', 'EADE Consulting J.E');
			$CI->email->to($info['destino']);
			$CI->email->subject($asunto);
			$CI->email->message($conten);
			$CI->email->send();
	}
}
